#ifndef CLOGIC_SOCKET_H
#define CLOGIC_SOCKET_H

#include "CSocket.h"
#include "MsgDef.h"

//处理逻辑和通信的子类
class CLogicSocket : public CSocket {	//继承自父类CSocket
public:
	CLogicSocket();
	virtual ~CLogicSocket();
	virtual bool init();

	//收发数据相关函数
	void sendNoBodyPkgToClient(LPMsgHeader pMsgHeader, unsigned short iMsgCode);

	//各种业务逻辑相关函数
	bool handleRegister(lp_connection_t pConn, LPMsgHeader pMsgHeader, char* pPkgBody, unsigned short iBodyLen);
	bool handleLogin(lp_connection_t pConn, LPMsgHeader pMsgHeader, char* pPkgBody, unsigned short iBodyLen);
	bool handlePing(lp_connection_t pConn, LPMsgHeader pMsgHeader, char* pPkgBody, unsigned short iBodyLen);

    virtual void procPingTimeout(LPMsgHeader pTmpMsg, time_t llCurTime);

	virtual void threadRecvProc(char* pMsgBuf);	//处理客户端请求，虚函数
};

extern CLogicSocket g_clLogicSocket;

#endif // !CLOGIC_SOCKET_H
